import React from "react";
import ReactDom from "react-dom";
import "./index.css";

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      door: "open",
    };
    // this.handleClick = this.handleClick.bind(this);
  }

  handleClick(id, e) {
    this.setState({
      door: "close",
    });
    console.log(id, e);
  }

  render() {
    const { door } = this.state;

    return (
      <h1 onClick={this.handleClick.bind(this, "id1")}>{door} 事件绑定</h1>
    );
  }
}

ReactDom.render(<App />, document.getElementById("root"));
